import java.util.Map;
import java.util.HashMap;


public class WriteOnceMap {

  public static void main(String[] args) {

  }

}


class WriteOnceMapDemo<K, V> extends HashMap<K, V> {

  public V put(K key, V value) {
    if (super.containsKey(key))
      throw new IllegalArgumentException(key + " already in map");
    return super.put(key, value);
  }

  public void putAll(Map<? extends K, ? extends V> m) {
    for (K key : m.keySet())
      if (super.containsKey(key))
        throw new IllegalArgumentException(key + " already in map");
    super.putAll(m);
  }

}
